package org.example.bookshelf_manager.dao;

import org.example.bookshelf_manager.model.BookInfo;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@Deprecated // 废弃
@Repository
public class BookDao {
    @Value("${book.num}")
    private Integer num;

    public List<BookInfo> mockData(){
        List<BookInfo> bookInfos = new ArrayList<>();
        for (int i = 1; i <= num; i++) {
            BookInfo bookInfo = new BookInfo();
            bookInfo.setId(i);
            bookInfo.setBookName("图书"+i);
            bookInfo.setAuthor("作者"+i);
            bookInfo.setCount(i*2+1);
            bookInfo.setPrice(new BigDecimal(i*4-3));
            if (i % 2 == 0){
                bookInfo.setPublish("1号出版社");
            }else {
                bookInfo.setPublish("4号出版社");
            }
            if (i % 5 == 0){
                bookInfo.setStatus(0);
//                bookInfo.setStatusCN("不可借阅");
            }else {
                bookInfo.setStatus(1);
//                bookInfo.setStatusCN("可借阅");
            }
            bookInfos.add(bookInfo);
        }
        return bookInfos;
    }
}
